Skip to content

build(lint): add Biome lint/format with Lefthook pre-push and CI gate - #307

Merged
egdev6 merged 13 commits into
mainfrom
chore/biome-lefthook
Nov 21, 2026
Merged

egdev6 merged 13 commits into
mainfrom
chore/biome-lefthook

Conversation

@egdev6

@egdev6 egdev6 commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Related issue / Issue relacionada

Issue: none (maintainer request).
ODD: not applicable to the roadmap; tracked locally in odd/tasks/biome-lefthook.md.

Scope / Alcance

Adds Biome lint/format, a Lefthook pre-push hook and the same check in CI.

  • Tooling (7006d90, 81e387f): biome.json covers src/, scripts/ and vite.config.ts. Excluded: vendored src/ds/egdev/ (copy, not edited by hand) and raw-imported src/assets/logos/*.svg (validated by security tests). The CSS formatter is off because UI tests assert literal theme.css/styles.css text; CSS is still linted. lefthook.yml pre-push runs npx biome ci and cargo fmt --check. New scripts: lint, format, check, check:fix, hooks:install. There is no prepare script: .github/security/policy.json allows no root npm lifecycle hooks, so contributors run npm run hooks:install once per clone. .gitattributes keeps Biome-checked files LF so biome ci does not fail on Windows checkouts with core.autocrlf. ci.yml and linux-pr-ci.yml run npx biome ci right after npm ci.
  • Formatting-only commit (ef1b86c, 175 files): output of npx biome format --write on 81e387f, listed in .git-blame-ignore-revs. Two source-grep tests were made whitespace-tolerant beforehand, in 81e387f.
  • Lint fixes (5b0075e, 71119c1): 106 errors → 0. Equivalent rewrites only (type="button", no <form> exists; forEach → for...of; equivalent regexes; renames in tests). Visible change: role="img" on two spans that carry an aria-label. The 17 hook dependency lists are unchanged and annotated with biome-ignore, because changing them would change when effects re-run. The 224 warnings stay visible and do not fail CI.
  • Docs: CONTRIBUTING EN/ES section "Lint and formatting".

Exclusions: no CSS formatting, no Rust linting (clippy), no warning cleanup.

⚠️ Merge with a merge commit or rebase, not squash: squashing changes the SHA listed in .git-blame-ignore-revs.

Coordination / Coordinación

N/A (non-ODD maintainer change). Open PRs will need git rebase main + npm run check:fix (currently #303). A Discord notice with sync steps goes out after merge.

Contributor / Contribuidor: @egdev6

Acceptance and validation / Aceptación y validación

  • Criteria satisfied: npx biome ci exits 0 (0 errors); pre-push exits 1 with a probe lint error and 0 on the clean tree.
  • Checks run: npm test (vitest 1241/1241, node --test 329 pass / 0 fail), npm run build (includes tsc --noEmit), cargo fmt --check, node scripts/i18n-inventory.mjs --check. Independent verification: format commit reproduced byte-identical from 81e387f; lint fixes reviewed for semantic equivalence; Biome scope probed with fixture files.
  • Checks not run: cargo test (no Rust changes). The CRLF case was reproduced locally with a core.autocrlf=true clone: biome ci exits 0 after the .gitattributes change. check-repository.mjs policy check: ok: true.
  • Remaining blockers: none.

An open PR does not mean integration. Release, secrets and signing operations require separate authorization.
Una PR abierta no implica integración. Release, secretos y firma requieren autorización separada.

Biome lints and formats src/, scripts/ and vite.config.ts (vendored
src/ds/egdev excluded). Lefthook runs biome ci and cargo fmt --check on
pre-push; ci.yml and linux-pr-ci.yml run biome ci after npm ci.
CSS stays linted but not formatted: ui-theme and quota tests assert
literal theme.css/styles.css text. Raw-imported provider SVGs are
vendored marks validated by security tests. Two source-grep tests now
accept line breaks so they do not depend on formatting.
Formatting-only commit produced by `npx biome format --write`; no
behavior change. Listed in .git-blame-ignore-revs.
Equivalent rewrites: [^] -> [\s\S], non-ASCII check as a code-unit
range, ??= out of expressions, forEach callbacks to for...of, renamed
helpers that shadowed the escape global or the after test hook, and
dropped unused exports from a test. Justified biome-ignore for the
intentional throw in the notary key cleanup and the single-render
capture components.
type="button" on buttons (no <form> exists, so no behavior change),
forEach callbacks to for...of, and role="img" where a span carries an
aria-label. Hook dependency lists are kept as they were and annotated
with biome-ignore, because changing them would change when effects
re-run. Also switch biome.json to the non-deprecated rules preset.
The repository policy allows no root npm lifecycle scripts, so the hook
is installed with `npm run hooks:install`. Windows checkouts with
core.autocrlf turned every file into CRLF and failed `biome ci`;
.gitattributes now keeps the formatted extensions LF.
@egdev6
egdev6 merged commit 533f2fb into main Nov 21, 2026
5 checks passed
@egdev6
egdev6 deleted the chore/biome-lefthook branch November 21, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant